/*
 * @Author: li 2696915640@qq.com
 * @Date: 2023-06-30 16:48:55
 * @LastEditors: li 2696915640@qq.com
 * @LastEditTime: 2023-07-18 09:59:59
 * @FilePath: \newpig\src\api\index.js
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */

import http from "@/components/utils/requect";

//获取所有学生的信息
export function allStudentInfo(params) {
  return http({
    url: "/api/college/allStudentInfo",
    method: "get",
    params: params
  });
}

//根据学生studentId获取指定学生的信息
export function studentInfo(params) {
  return http({
    url: "/api/college/studentInfo",
    method: "get",
    params: params
  });
}

//保存筛选条件，生成学生方案，生成方案对应志愿记录,拿到总记录数、冲稳保的条数
export function saveAndOptimize(data) {
  return http({
    url: "/api/college/saveAndOptimize",
    headers: {
      "Content-Type": "application/json"
    },
    method: "post",
    data //FilterCondition
  });
}

//显示指定方案志愿记录以供优化 或 调整指定方案志愿记录的位次，拿到(优化后的)指定方案对应的志愿记录，以及冲稳保条数
export function schemeOptimize(data) {
  return http({
    url: "/api/college/schemeOptimize",
    headers: {
      "Content-Type": "application/json"
    },
    method: "post",
    data //SchemeDisplay
  });
}

//根据方案schemeId删除指定方案
export function schemeDelete(params) {
  return http({
    url: "/api/college/schemeDelete",
    method: "get",
    params: params
  });
}

//根据指定方案id和方案志愿记录id删除方案中的志愿记录,前端手动删除，后端修改逻辑删除字段即可
export function recordDelete(data) {
  return http({
    url: "/api/college/recordDelete",
    headers: {
      "Content-Type": "application/json"
    },
    method: "post",
    data //SchemeDisplay
  });
}

//根据方案schemeId，显示出方案最初的总志愿记录里，未选择的志愿记录
export function addNewRecord(params) {
  return http({
    url: "/api/college/addNewRecord",
    method: "get",
    params: params
  });
}

//根据志愿方案id，以及要新增的志愿记录ids，给当前方案新增对应的志愿记录，前端手动新增，后端修改逻辑字段即可
// todo 参数类型暂定
export function newRecordSave(data) {
  return http({
    url: "/api/college/newRecordSave",
    headers: {
      "Content-Type": "application/json"
    },
    method: "post",
    data
  });
}

//根据方案schemeId，显示出方案最初的总志愿记录里，未选择的志愿记录
export function exportExcel(params) {
  return http({
    url: "/api/college/exportExcel",
    method: "get",
    params: params,
    responseType: 'blob',
  });
  
}